//首部时间日期显示
function updateTime() {
    // 获取当前时间
    const now = new Date();
    // 格式化日期和时间
    const dateOptions = {year: 'numeric', month: '2-digit', day: '2-digit'};
    const timeOptions = {hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false};

    const formattedDate = now.toLocaleDateString('zh-CN', dateOptions); // 使用中文格式
    const formattedTime = now.toLocaleTimeString('zh-CN', timeOptions); // 使用中文格式

    // 将日期和时间分别插入到对应的span中
    document.querySelector('.header-date-text').textContent = formattedDate;
    document.querySelector('.header-time-text').textContent = formattedTime;
}

//请求毁伤评估
async function getStrikeResult(taskId) {
    // 调用后端接口
    const response = await fetch(`/get-task-damage-result/${taskId}/`);
    if (!response.ok) throw new Error('请求失败');
    const data = await response.json();
    console.log(data)
    document.getElementById('resultContent').textContent = JSON.stringify(data.result);
    document.getElementById('resultModal').style.display = 'block';
}

//关闭毁伤评估的对话框
function closeModal() {
    document.getElementById('resultModal').style.display = 'none';
}